import requests


class IHRMBranchApi:
    #定义添加部门的接口
    @classmethod
    def add_branch_api(cls,token,data):
        url = 'http://ihrm-test.itheima.net/api/company/department'
        header = {"Content-Type": "application/json","Authorization": token}
        resp = requests.post(url=url, headers=header, json=data)
        return resp
    #定义查询部门的接口
    @classmethod
    def query_branch_api(cls, departmentId,token):
        url = 'http://ihrm-test.itheima.net/api/company/department/'+departmentId
        header = {"Authorization": token}
        resp = requests.get(url=url, headers=header)
        return resp
    #定义修改员工的接口
    @classmethod
    def modify_branch_api(cls, departmentId,token,data):
        url = 'http://ihrm-test.itheima.net/api/company/department/'+departmentId
        header = {"Content-Type": "application/json",
                                "Authorization": token}
        resp = requests.put(url=url, headers=header, json=data)
        return resp
    #定义删除员工的接口
    @classmethod
    def del_branch_api(cls,departmentId,token):
        url = 'http://ihrm-test.itheima.net/api/company/department/'+departmentId
        header = {"Authorization": token}
        resp = requests.delete(url=url, headers=header)
        return resp